#if !defined(_CONFIG_H_)
#define _CONFIG_H_

#include <sys/types.h>
#include <unistd.h>
#include <iostream>
#include <set>
#include <vector>
#include <boost/asio/ip/tcp.hpp>
#include <boost/unordered_set.hpp>

struct uid_value
{
    public:
      uid_value () : uid (0) {}	
      uid_value (uid_t const& u) : uid (u) {}
      operator uid_t () const { return uid; }
      uid_t uid;
};

struct gid_value
{
    public:
	gid_value () : gid (0) {}
	gid_value (gid_t const& g) : gid (g) {}
	operator gid_t () const { return gid; }
	gid_t gid;
};

struct server_parameters
{

    struct remote_point
    {
    	//ip[:port]
    	std::string m_host_address;
    	unsigned int m_port;
    };
    
    remote_point m_listen_point;
    
    unsigned int m_worker_count;
    
    unsigned int m_rescan_time;
    
    bool m_dump_all_packet;
    bool m_dump_all_query;
    
    bool m_foreground;
    
    std::string m_pid_file;
    
    uid_value m_uid;
    gid_value m_gid;

    std::string connect_host_;
    std::string connect_user_;
    std::string connect_password_;
    std::string connect_database_;
    
    int time_sync_diff_sec_;

    bool parse_config(int _argc, char* _argv[], std::ostream& _out);
};

extern server_parameters g_config;


#endif //_CONFIG_H_
